package view
{
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;

    import view.ImageLocator;

    public class Item extends Sprite
    {
        public static var TYPE_EMPTY:int = 0;
        public static var TYPE_UP:int = 1;
        public static var TYPE_DOWN:int = 2;
        public static var TYPE_EGG:int = 3;
        public static var EGG:Bitmap = new ImageLocator.scoreEgg();

        public var type:int;

        public function Item(t:int, x:Number, y:Number)
        {
            this.type = t;
            this.x = x;
            this.y = y;
            Item.EGG.x = 0;
            Item.EGG.y = 0;
            if(t == Item.TYPE_EGG)
            {
                this.addChild(Item.EGG);
            }
        }

        public function display():void
        {
            this.graphics.clear();
            this.graphics.lineStyle(0, 0, 0);
            if(this.type == Item.TYPE_UP)
            {
                this.graphics.beginFill(0xFF0000, 0.8);
            }
            else if(this.type == Item.TYPE_DOWN)
            {
                this.graphics.beginFill(0x000000, 0.8);
            }
            this.graphics.drawCircle(5, 5, 10);
            this.graphics.endFill();
        }

        public function move(speed:int):void
        {
            this.x -= speed;
        }
    }
}
